<?php
class FranjasView extends CustomView
{

    public function nuevaFranja($vars = array())
    {
        $this->top();
        $this->setTemplate('nueva');
        $this->parse('nueva', $vars);
        $this->bottom();
    }

    public function editarFranja($vars = array())
    {
        $this->top();
        $this->setTemplate('editar');
        $this->parse('editar', $vars);
        $this->bottom();
    }

    public function verFranjas($vars = array())
    {
        $this->top();
        $this->setTemplate('ver');
        $vars['pagination'] = $this->buildPagination($vars['pagination_link'], $vars['franjas']);
        $this->parse('ver', $vars);
        {
            if (!empty($vars['franjas']['results']))
            {
                foreach ($vars['franjas']['results'] as $franja)
                {
                    $franja['checked_1'] = ($franja['dias']&BITMAP_LUNES)?'checked="checked"':'';
                    $franja['checked_2'] = ($franja['dias']&BITMAP_MARTES)?'checked="checked"':'';
                    $franja['checked_3'] = ($franja['dias']&BITMAP_MIERCOLES)?'checked="checked"':'';
                    $franja['checked_4'] = ($franja['dias']&BITMAP_JUEVES)?'checked="checked"':'';
                    $franja['checked_5'] = ($franja['dias']&BITMAP_VIERNES)?'checked="checked"':'';
                    $franja['checked_6'] = ($franja['dias']&BITMAP_SABADO)?'checked="checked"':'';
                    $franja['checked_7'] = ($franja['dias']&BITMAP_DOMINGO)?'checked="checked"':'';
                    $franja['horario_desde'] = secondsToTime($franja['horario_desde']);
                    $franja['horario_hasta'] = secondsToTime($franja['horario_hasta']);
                    $this->parse('franja', $franja);
                }
            }
			else
			{
				$this->parse('sin_resultados');
			}
        }
        $this->parse('ver', $vars);
        $this->bottom();
    }

}
?>